package com.kaikeba.estack.web.constant;

import com.kaikeba.estack.bean.Message;

/**
 * @Auth xingwan
 * @Date 2020/10/3 0:03
 **/
public enum ErrorConstant {

    SUCCESS(0, "成功"),
    ERROR(-1, "失败"),

    ADMIN_LOGIN_FAILED(-10001, "登录失败"),
    ADMIN_LOGIN_PASSWORD_RESOLVE_ERROR(-10002, "非法登录,密码解析失败");

    private int code;

    private String msg;

    ErrorConstant(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public int getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    public Message toMessage() {
        return new Message(this.getCode(), this.getMsg());
    }
}
